﻿using DapperExtensions.Mapper;
using Newtonsoft.Json;

namespace ZilLion.Service.TaskPlatform.Domain.Entity
{
    /// <summary>
    ///     节点信息
    /// </summary>
    public class NodeInfoEntity
    {
        /// <summary>
        ///     节点ID
        /// </summary>
        [JsonProperty("nodeid")]
        public string Nodeid { get; set; }

        /// <summary>
        ///     节点名称（别名）
        /// </summary>
        [JsonProperty("nodename")]
        public string Nodename { get; set; }

        /// <summary>
        ///     节点计算机名
        /// </summary>
        [JsonProperty("nodepcname")]
        public string Nodepcname { get; set; }

        /// <summary>
        ///     节点IP
        /// </summary>
        [JsonProperty("nodeip")]
        public string Nodeip { get; set; }

        /// <summary>
        ///     节点Mac
        /// </summary>
        [JsonProperty("nodemac")]
        public string Nodemac { get; set; }

        /// <summary>
        ///     节点其他信息（json字符串，描述更多的系统信息）
        /// </summary>
        [JsonProperty("noderemark")]
        public string Noderemark { get; set; }
    }

    public sealed class NodeInfoEntityMapper : ClassMapper<NodeInfoEntity>
    {
        public NodeInfoEntityMapper()
        {
            Table("node_info");
            Map(f => f.Nodeid).Key(KeyType.Assigned).Column("nodeid");
            Map(f => f.Nodename).Column("nodename");
            Map(f => f.Nodepcname).Column("nodepcname");
            Map(f => f.Nodeip).Column("nodeip");
            Map(f => f.Nodemac).Column("nodemac");
            Map(f => f.Noderemark).Column("noderemark");
        }
    }
}